package org.sunriz.utils;

import java.util.regex.*;

public class InfoGet {




    /**
     * 取出当前行的pageNumber
     * @param line
     * @return pageNumber
     */
    public static String getPageNumber(String line) {
        // 第一种情况：Page=106,小机B盘车电动机
        Pattern pattern2 = Pattern.compile("Page=(\\d+),");
        Matcher matcher2 = pattern2.matcher(line);
        if (matcher2.find()) {
            return matcher2.group(1);
        }
     
        // 第二种情况：Page, 106:2, 20 x10ms 6 1 1
        Pattern pattern1 = Pattern.compile("Page,\\s*(\\d+):");
        Matcher matcher1 = pattern1.matcher(line);
        if (matcher1.find()) {
            return matcher1.group(1);
        }
        return null; // 没有匹配到
    }
}